package com.zbkj.front.controller;

import com.zbkj.common.result.CommonResult;
import com.zbkj.service.service.DeliveryPersonnelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 途狐管车控制器
 */
@Slf4j
@RestController
@RequestMapping("api/front/tuhu")
@Api(tags = "途狐管车控制器")
public class TuhuController {

    @Autowired
    private DeliveryPersonnelService deliveryPersonnelService;


    @ApiOperation(value = "根据账户获取车辆列表")
    @RequestMapping(value = "/vehicle/list/{userId}", method = RequestMethod.GET)
    public CommonResult<Map<String, Object>> vehicleList(@PathVariable String userId) {
        return CommonResult.success(deliveryPersonnelService.vehicleList(userId));
    }


    @ApiOperation(value = "根据IMEI获取最新定位数据")
    @RequestMapping(value = "/vehicle/{imei}", method = RequestMethod.GET)
    public CommonResult<String> getLocationByImei(@PathVariable String imei) {
        return CommonResult.success(deliveryPersonnelService.getLocationByImei(imei));
    }


    @ApiOperation(value = "我的个人中心配送地图定位数据")
    @RequestMapping(value = "/my/center", method = RequestMethod.POST)
    public CommonResult<Map<String,String>> getCenter() {
        return CommonResult.success(deliveryPersonnelService.getCenter());
    }


}
